HISTCONTROL=ignoreboth

shopt -s histappend

HISTSIZE=1000
HISTFILESIZE=2000

shopt -s checkwinsize

if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
	color_prompt=yes
    else
	color_prompt=
    fi
fi

color_prompt=yes

if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias rm='rm -i'
alias grep='grep --color=auto'
alias dir='dir --color=auto'
alias reapache='sudo service apache2 restart'
alias remysql='sudo service mysql restart'
alias lsport='netstat -alnp|grep -w LISTEN'
alias slsport='sudo netstat -alnp|grep -w LISTEN'

alias gits='git status '
alias gita='git add . '
alias gitpl='git pull ' 
alias gitps='git push '
alias gitc='git commit -m  '
alias gitls='git ls-files|more '
alias gitlg='git log '

alias svns='svn status '
alias svna='svn add '
alias svnu='svn up ' 
alias svnc='svn checkout ' 
alias svnc='svn commit -m '
alias svnl='svn log|less'

alias apts='apt-cache search '
alias apti='sudo apt-get install '

alias scat='sudo cat '
alias smore='sudo more '
alias sless='sudo less '
alias shead='sudo head '
alias stail='sudo tail '
alias sll='sudo ls -l '
alias svim='sudo vim '
alias svirsh='sudo virsh '
alias ipy='ipython '

#walter add
alias pyshare='python -m SimpleHTTPServer 9001 '

export SVN_EDITOR="vim"
export EDITOR=vim

FG_GRAY="\[\033[0;37m\]"
FG_RED="\[\033[0;31m\]"
FG_GREEN="\[\033[0;32m\]"
FG_BLUE="\[\033[0;34m\]"
FG_YELLOW="\[\033[0;33m\]"

FG_LIGHT_RED="\[\033[1;31m\]"
FG_LIGHT_YELLOW="\[\033[1;33m\]"
FG_LIGHT_GREEN="\[\033[1;32m\]"
FG_LIGHT_BLUE="\[\033[0;34m\]"
FG_LIGHT_GRAY="\[\033[1;37m\]"

BG_GRAY="\e[47m"    # 将背景色设置为灰色 
BG_BLACK="\e[40m"   # 将背景色设置为黑色
BG_RED="\e[41m"    # 将背景色设置为红色 
BG_GREEN="\e[42m"    # 将背景色设置为红色 
BG_YELLOW="\e[43m"     # 将背景色设置为淡红色
BG_BLUE="\e[46m"    # 将背景色设置为淡蓝色

BG_LIGHT_RED="\e[41m"       # 将背景色设置为红色
BG_LIGHT_GREEN="\e[42m"     # 将背景色设置为绿色
BG_LIGHT_BLUE="\e[44m"      # 将背景色设置为蓝色
BG_LIGHT_PINK="\e[45m"      # 将背景色设置为紫色

END="\[\033[0;00m\]"

#ip=`/sbin/ifconfig eth0|grep -w 'inet'|grep  -v '127.0.0.1'|tail -1|awk '{print $2}'|cut -d":" -f2`
#ts=`date +%s`
#now=`date +"%Y-%m-%d %H-%M:%S"`

function parse_git_branch {
    git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}

PS1="\n$FG_GRAY[\t]$FG_LIGHT_RED[\u$END@$FG_LIGHT_RED$ip($END\h$FG_LIGHT_RED)]$FG_GRAY[\w]$FG_YELLOW\$(parse_git_branch)$END\n\$ "

#export PS1="\n$FG_GRAY[\t]$FG_LIGHT_RED[\u$END@$FG_LIGHT_RED$ip($END\h$FG_LIGHT_RED)]$FG_GRAY[\w]$FG_YELLOW\$(parse_git_branch)$END\n\$ "

export PS1="\n[\t][\u@$ip(\h)][\w]\$(parse_git_branch)\n\$ "
export TURTLE_BUILD_MINE_PATH="/opt/walter/workspace/svn/aturtle/aturtle_server/server/build_mine/"

export DISTCC_HOSTS='localhost 10.1.1.239 10.1.1.113 10.1.1.237'
export DISTCC_VERBOSE=0
export DISTCC_LOG='/tmp/disstcc_walter.log'

# java src path config
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:~/.vim/autoload
export PATH JAVA_HOME CLASSPATH

# maven config
M2_HOME=/usr/local/apache-maven-3.2.2
#M2_HOME=/opt/walter/.test/code/exercise/java_test/apache-maven-3.0.5
GRADLE_HOME=/opt/walter/tmp/gradle-2.5
export MAVEN_OPTS="-Xms256m -Xmx512m"
export PATH=$M2_HOME/bin:$PATH
export PATH=$GRADLE_HOME/bin:$PATH

export TERM="screen-256color"
alias tmux="tmux -2"
